import { defineConfig } from 'vitepress'
import { nav } from './configs'
import AutoSidebar from 'vite-plugin-vitepress-auto-sidebar'

// https://vitepress.dev/reference/site-config
export default defineConfig({
  vite: {
    plugins: [
      // add plugin
      // 文档地址：https://github.com/QC2168/vite-plugin-vitepress-auto-sidebar
      AutoSidebar({
        ignoreList: ['nav'],
        collapsed: true,
        titleFromFile: true,
      }),
    ],
  },
  base: '/hhhhz-doc/',
  title: '浩耗浩耗丶子🐭',
  // description: "A VitePress Site",

  /* markdown 配置 */
  markdown: {
    lineNumbers: true,
  },

  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav,

    lastUpdated: {
      text: '最后更新于',
      formatOptions: {
        dateStyle: 'short',
        timeStyle: 'medium',
      },
    },

    docFooter: {
      prev: '上一篇',
      next: '下一篇',
    },

    returnToTopLabel: '回到顶部',
    sidebarMenuLabel: '菜单',
    darkModeSwitchLabel: '主题',
    lightModeSwitchTitle: '切换到浅色模式',
    darkModeSwitchTitle: '切换到深色模式',

    socialLinks: [{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }],

    /* 右侧大纲配置 */
    outline: {
      level: 'deep',
      label: '目录',
    },
    // 搜索框
    search: {
      provider: 'local',
      options: {
        _render(src, env, md) {
          const html = md.render(src, env)
          if (env.frontmatter?.title) return md.render(`# ${env.frontmatter.title}`) + html
          return html
        },
      },
    },
  },
})
